package com.cyy.admin.controller;

import com.alibaba.fastjson.JSON;
import com.cyy.admin.entity.SysSystemsettingEntity;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import com.cyy.admin.service.SysSystemsettingService;

import javax.annotation.PostConstruct;

/**
 * 
 *
 * @author chenyuyi
 * @date 2021-12-10 10:31:10
 */
@Api(tags = "admin")
@RestController
@RequestMapping("admin/syssystemsetting")
public class SysSystemsettingController {

    @Autowired
    private SysSystemsettingService sysSystemsettingService;

    @Autowired
    private StringRedisTemplate redisTemplate;

    @PostConstruct
    private void loadSystemSetting(){
        SysSystemsettingEntity setting = sysSystemsettingService.selectById("1");
        redisTemplate.opsForValue().set("systemSetting", JSON.toJSONString(setting));
    }

}